package com.kyxx.mycommonproject.sousuo.presenter;

import android.content.Context;

import com.kyxx.mycommonproject.sousuo.model.SearchResultModel;
import com.kyxx.mycommonproject.sousuo.model.SearchSimilarModel;
import com.kyxx.mycommonproject.sousuo.model.callBack.SearchResultListener;
import com.kyxx.mycommonproject.sousuo.model.callBack.SearchSimilarListener;
import com.kyxx.mycommonproject.sousuo.view.ISerachFramentView;

import java.util.ArrayList;

/**
 * Created by Administrator on 2016/9/9.
 */
public class SearchFragmentPresenter {
    private ISerachFramentView view;
    private SearchResultModel resultModel;
    private SearchSimilarModel similarModel;
    private Context ctx;
    public SearchFragmentPresenter(Context ctx,ISerachFramentView view){
        this.view = view;
        this.resultModel = new SearchResultModel();
        this.similarModel = new SearchSimilarModel();
        this.ctx = ctx;
    }

    public void getSearchResult(String content){
        resultModel.getSearchResultData(content,ctx, new SearchResultListener() {
            @Override
            public void onSuccess() {
                view.SearchResultData();
            }

            @Override
            public void onFailed() {

            }

            @Override
            public void onStart() {

            }

            @Override
            public void onFinish() {

            }
        });
    }
    public void getSearchSimilar(String content){
        similarModel.getSearchSimilarData(content,ctx, new SearchSimilarListener() {
            @Override
            public void onSuccess(ArrayList<String> s) {
                view.SearchSimilarData(s);
            }

            @Override
            public void onFailed() {

            }

            @Override
            public void onStart() {

            }

            @Override
            public void onFinish() {

            }
        });
    }
}
